package com.mico.example.springboot.jpa.service.impl;

import com.mico.example.springboot.jpa.domain.User;
import com.mico.example.springboot.jpa.repository.UserRepository;
import com.mico.example.springboot.jpa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;


/**
 * Created by micocube
 * ProjectName: springboot-example
 * PackageName: com.mico.example.springboot.jpa.service.impl
 * User: micocube
 * Email: ldscube@gmail.com
 * CreateTime: 2019/2/25下午1:52
 * ModifyTime: 2019/2/25下午1:52
 * Version: 0.1
 * Description:
 **/
@Service
public class UserServiceImpl implements UserService{
    @Autowired
    UserRepository userRepository;

    public Page<User> findByUsername(String name, Pageable pageable){
        return userRepository.findByUsername(name,pageable);
    }


    public User findByUsername(String name) {
        return userRepository.findByUsername(name);
    }


    public Page<User> findAll(Pageable pageable){
        return userRepository.findAll(pageable);
    }

}
